﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<link href="plugins/kindeditor/themes/simple/simple.css" type="text/css" rel="stylesheet">
<link href="plugins/kindeditor/themes/default/default.css" rel="stylesheet">
<!-- jsp文件头和头部 -->
<%@ include file="../index/top.jsp"%>

</head>
<body class="no-skin">

	<!-- /section:basics/navbar.layout -->
	<div class="main-container" id="main-container">
		<!-- /section:basics/sidebar -->
		<div class="main-content">
			<div class="main-content-inner">
				<div class="page-content">
				
					<div class="page-header">
							<h1>
								<small>
									<i class="ace-icon fa fa-angle-double-right"></i>
									编辑菜单
								</small>
							</h1>
					</div><!-- /.page-header -->

					<div class="row">
						<div class="col-xs-12">

						<form  action="classify/${MSG }.do" name="classifyForm" id="classifyForm" method="post" class="form-horizontal">
							<input type="hidden" name="id" id="id" value="${pd.id}"/>
							<input type="hidden" name="parentid" id="parentid" value="${null == pd.parentid ? id:pd.parentid}"/>
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 上级 :</label>
								<div class="col-sm-9">
									<div style="padding-top:5px;">
										<div class="col-xs-4 label label-lg label-light arrowed-in arrowed-right">
											<b>${null == pds.name ?'(无) 此项为顶级菜单':pds.name}</b>
										</div>
									</div>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 名称 :</label>
								<div class="col-sm-9">
									<input type="text" name="name" id="name" value="${pd.name }" placeholder="这里输入分类名称" class="col-xs-10 col-sm-5" />
								</div>
							</div>
							<div class="form-group">
                              <label class="col-sm-3 control-label no-padding-right" for="form-field-1">上传图标 :</label>
                              <div class="col-sm-9"  style="margin-top:10px;">
                                <a href="javascript:void(0)" class="onePicUpload">上传图片</a> <c:if test="${not empty pd.icoImg}">
                                            <a href='${pd.icoImg }' target='_blank'><img src='${pd.icoImg }' width='80' height='50' /></a>
                                          </c:if> <input type="hidden" id="icoImg" name="icoImg" value="${pd.icoImg }" />
                              </div>
                            </div>
							<div class="clearfix form-actions">
								<div class="col-md-offset-3 col-md-9">
									<a class="btn btn-mini btn-primary" onclick="save();">保存</a>
									<a class="btn btn-mini btn-danger" onclick="goback('${id}');">取消</a>
								</div>
							</div>
							<div class="hr hr-18 dotted hr-double"></div>
						</form>

						</div>
						<!-- /.col -->
					</div>
					<!-- /.row -->
				</div>
				<!-- /.page-content -->
			</div>
		</div>
		<!-- /.main-content -->


		<!-- 返回顶部 -->
		<a href="#" id="btn-scroll-up"
			class="btn-scroll-up btn btn-sm btn-inverse"> <i
			class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
		</a>

	</div>
	<!-- /.main-container -->

	<!-- basic scripts -->
	<!-- 页面底部js¨ -->
	<%@ include file="../index/foot.jsp"%>
	<!--提示框-->
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
  <script type="text/javascript" src="static/js/common/file_upload.js"></script>
  <script type="text/javascript" src="plugins/kindeditor/kindeditor-all.js"></script>
	<!-- inline scripts related to this page -->
	<script type="text/javascript">
		$(top.hangge());
		
		$(function(){
			//创建富文本编辑器
			TAOTAO.kingEditorParams = {
				//指定上传文件参数名称
				filePostName  : "uploadFile",
				//指定上传文件请求的url。
				uploadJson : '<%=basePath%>pic/upload',
				//上传类型，分别为image、flash、media、file
				dir : "image",
				extraFileUploadParams:{isCom:"01",width:800,height:800,quality:0.8,end:"view"}
			}
			
			TAOTAO.kingEditorAutoParams = {
					//指定上传文件参数名称
					filePostName  : "uploadFile",
					//指定上传文件请求的url。
					uploadJson : '<%=basePath%>pic/upload',
					//上传类型，分别为image、flash、media、file
					dir : "image",
					extraFileUploadParams:{isCom:"00"}
				}
			
			//初始化类目选择和图片上传器
			TAOTAO.initOnePicUpload($("input[name=icoImg]").val());
		
		});
		
		//返回
		function goback(id){
			top.jzts();
			window.location.href="<%=basePath%>classify.do?id="+id;
		}
		
		//保存
		function save(){
			if($("#name").val()==""){
				$("#name").tips({
					side:3,
		            msg:'请输入菜单名称',
		            bg:'#AE81FF',
		            time:2
		        });
				$("#name").focus();
				return false;
			}
			$("#classifyForm").submit();
		}
		
	</script>
</body>
</html>